package br.com.sig.security.presentation.action;
import java.util.ArrayList;

import javax.annotation.PostConstruct;
import javax.faces.bean.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;

import br.com.sig.presentation.action.BaseAction;
import br.com.sig.security.business.model.bo.RoleBO;
import br.com.sig.security.business.model.entity.Permission;
import br.com.sig.security.business.model.entity.Role;

@Named
@ViewScoped
public class RoleAction extends BaseAction<Role> {

	private static final long serialVersionUID = -1634914936667632291L;

	@Inject
	private RoleBO roleBO;

	@PostConstruct
	public void init() {
		setService(roleBO);
	}
	
	@Override
	protected Role createInstance() {
		Role role = super.createInstance();
		role.setPermissions(new ArrayList<Permission>());
		return role;
	}
}